using System;
using System.Collections.Generic;
using System.Text;
using aoa.csharp.pc.DondeEstas.localizame;
using System.Net;
using System.IO;

namespace Donde_Estas_PC
{
    public class Class1
    {
        public static void Main(string[] args)
        {
            try
            {
                DondeEstas lib = new DondeEstas();

                List<MyHttpRequestHeader> list = new List<MyHttpRequestHeader>();
                list.Add(new MyHttpRequestHeader(HttpRequestHeader.AcceptLanguage, "es"));
                list.Add(new MyHttpRequestHeader(HttpRequestHeader.AcceptEncoding, "identity"));
                //list.Add(new MyHttpRequestHeader(HttpRequestHeader.Accept, "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*"));
                //list.Add(new MyHttpRequestHeader(HttpRequestHeader.Connection, "Keep-Alive"));
                //list.Add(new MyHttpRequestHeader(HttpRequestHeader.Host, "http://www.google.es"));

//                list.Add(new MyHttpRequestHeader(HttpRequestHeader.Referer,"http://www.localizame.movistar.es/login.do"));

                //WebResponse response = lib.httpPost("http://www.google.es", "application/x-www-form-urlencoded", new MyHttpRequestHeader[0], "");
//                WebResponse response = lib.httpPost("http://www.google.es", "application/x-www-form-urlencoded", list.ToArray(), "");
////                WebResponse response = lib.httpPost("http://www.movistar.es", "application/x-www-form-urlencoded", list.ToArray(), "");

////                WebResponse response = lib.httpGet("http://www.google.es/search", "application/x-www-form-urlencoded", list.ToArray(), "hl=es&q=mail", "");
                WebResponse response = lib.httpGet("http://www.google.es/search", "application/x-www-form-urlencoded", list.ToArray(), "hl=es&q=mail", "http://www.localizame.movistar.es/login.do");

                Console.Out.WriteLine(response.ToString());
                StreamReader sw = new StreamReader(response.GetResponseStream());
                string datos = sw.ReadToEnd();

                Console.Out.WriteLine(datos);

                
                Console.In.ReadLine();
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(ex.Message);
                Console.In.ReadLine();
            }
        }
    }
}
